import request from '@/utils/request'

// 查询数据建模列表
export function listDefine(query) {
  return request({
    url: '/lc/datamodel/define/list',
    method: 'get',
    params: query
  })
}

// 查询数据建模详细
export function getDefine(id) {
  return request({
    url: '/lc/datamodel/define/' + id,
    method: 'get'
  })
}

// 新增数据建模
export function addDefine(data) {
  return request({
    url: '/lc/datamodel/define',
    method: 'post',
    data: data
  })
}

// 修改数据建模
export function updateDefine(data) {
  return request({
    url: '/lc/datamodel/define',
    method: 'put',
    data: data
  })
}

// 删除数据建模
export function delDefine(id) {
  return request({
    url: '/lc/datamodel/define/' + id,
    method: 'delete'
  })
}


// 发布数据建模
export function publishDefine(id) {
  return request({
    url: '/lc/datamodel/define/publish/' + id,
    method: 'put'
  })
}

// 发布数据建模
export function weihuDefine(id) {
  return request({
    url: '/lc/datamodel/define/weihu/' + id,
    method: 'put'
  })
}


//********************以下是对数据列的操作********************** */
//删除列
export function deleteColumnByCode(defineCode, code) {
  return request({
    url: '/lc/datamodel/define/deleteColumnByCode',
    method: 'post',
    data: {
      'code': code,
      'defineCode': defineCode
    }
  })
}

//查询所有列
export function listColumns(defineCode) {
  return request({
    url: '/lc/datamodel/define/listColumns/'+defineCode,
    method: 'post'
  })
}


//保存列
export function saveColumns(column) {
  return request({
    url: '/lc/datamodel/define/saveColumns',
    method: 'post',
    data: column
  })
}

//保存列
export function getLcDatamodelColumn(defineCode, code) {
  return request({
    url: '/lc/datamodel/define/getLcDatamodelColumn',
    method: 'post',
    data: {
      'code': code,
      'defineCode': defineCode
    }
  })
}

